<template>
	<view class="page flex-col">

		<view class="block_1 flex-row">
			<view class="section_1 flex-row justify-between">
				<view class="image-text_1 flex-row justify-between">
					<!-- 头像 -->
					<image class="single-avatar_1" referrerpolicy="no-referrer" src="/static/my/avatar_1.png" />
					<view class="text-group_1 flex-col justify-between">
						<text class="text_2">{{admin}}</text>
						<text class="text_3">{{companyName}}({{roleName}})</text>
					</view>
				</view>
				<button class="button_1 flex-col" @click="changeCompany">
					<text class="text_4">切换公司</text>
				</button>
			</view>
		</view>
		<view class="block_2 flex-col justify-around">
			<!-- <view @click="notice" class="box_1 flex-row justify-between">
				<view class="image-text_2 flex-row justify-between">
					<view class="icon_1 flex-col">
						<image class="label_1" referrerpolicy="no-referrer" src="/static/my/notification.png" />
					</view>
					<text class="text-group_2">绑定公众号接收通知</text>
				</view>
				<image class="icon_2" referrerpolicy="no-referrer" src="/static/my/right_arrow.png" />
			</view> -->

			<view @click="mySetting" class="box_1 flex-row justify-between">
				<view class="image-text_3 flex-row justify-between">
					<image class="icon_3" referrerpolicy="no-referrer" src="/static/my/setting.png" />
					<text class="text-group_3">我的设置</text>
				</view>
				<image class="icon_2" referrerpolicy="no-referrer" src="/static/my/right_arrow.png" />
			</view>

			<view @click="logout" class="box_1 flex-row justify-between">
				<view class="image-text_3 flex-row justify-between">
					<image class="icon_3" referrerpolicy="no-referrer" src="/static/my/logout.png" />
					<text class="text-group_3">退出登录</text>
				</view>
				<image class="icon_2" referrerpolicy="no-referrer" src="/static/my/right_arrow.png" />
			</view>

		</view>

		<!-- <u-picker  :show="show" :columns="columns" keyName="label" @confirm="handleConfirm" @cancel="handleCancel"></u-picker> -->
	</view>

</template>

<script>
	import store from "../../stores";
	import setting from "../../js/api/setting";

	const app = getApp();
	export default {
		data() {
			return {
				companyName: '',
				admin: "",
				roleName: '',
				show: true,
				columns: [],
			}
		},
		onLoad() {
			this.loadStorageSync()
		},
		computed: {
			update() {
				this.loadStorageSync()
				if (store.state.user) {
					this.admin = store.state.user.realName
					this.roleName = store.state.user.roleInfo.name
					this.companyName = store.state.user.accountSets.companyName
				}
			}
		},
		methods: {
			loadStorageSync() {
				let accountCache = uni.getStorageSync('cache_config_info_key')
				if (accountCache) {
					this.admin = accountCache.realName
					this.roleName = accountCache.roleInfo.name
					this.companyName = accountCache.accountSets.companyName
				}
			},
			handleConfirm(e) {
				console.log(e.value[0].label, 1111111111);
			},
			handleClose() {
				this.show = false;
			},
			changeCompany() {
				uni.navigateTo({
					url: '/pages/company-list/company-list'
				})
			},
			notice(e) {
				console.log("接收通知", e)
			},

			mySetting() {
				console.log("我的设置")
				uni.navigateTo({
					url: '/pages/setting/setting'
				})
			},
			logout() {
				uni.showModal({
					title: '提示',
					content: '确认退出登录',
					success(res) {
						if (res.confirm) {
							setting.logout().then(() => {
								app.globalData.showToast("退出成功");
								store.commit("setCustom", null)
								uni.clearStorageSync();
								uni.navigateTo({
									url: '/pages/login/login'
								})
							})
						}
					}
				});
			},
		}
	}
</script>
<style>
	.page {
		background-color: rgba(246, 247, 248, 1);
		position: relative;
		width: 750rpx;
		height: 1624rpx;
		overflow: hidden;
	}

	.block_1 {
		background-color: rgba(60, 114, 255, 1);
		border-radius: 0px 0px 2px 2px;
		position: relative;
		width: 750rpx;
		height: 320rpx;
	}

	.nav-bar_1 {
		width: 750rpx;
		height: 98rpx;
		margin-top: 8rpx;
	}

	.text_1 {
		width: 72rpx;
		height: 32rpx;
		overflow-wrap: break-word;
		color: rgba(255, 255, 255, 1);
		font-size: 36rpx;
		font-family: PingFangSC-Semibold;
		font-weight: 600;
		text-align: left;
		white-space: nowrap;
		line-height: 32rpx;
		margin: 38rpx 0 0 32rpx;
	}

	.applet-top-bar_1 {
		width: 174rpx;
		height: 64rpx;
		margin: 22rpx 32rpx 0 0;
	}

	.section_1 {
		background-color: rgba(255, 255, 255, 1);
		border-radius: 2px;
		position: absolute;
		//left: 32rpx;
		top: 175rpx;
		width: 750rpx;
		height: 235rpx;
	}

	.image-text_1 {
		width: 440rpx;
		height: 160rpx;
		margin: 28rpx 0 0 28rpx;
	}

	.single-avatar_1 {
		width: 160rpx;
		height: 160rpx;
	}

	.text-group_1 {
		width: 256rpx;
		height: 98rpx;
		margin-top: 14rpx;
	}

	.text_2 {
		width: 256rpx;
		height: 44rpx;
		overflow-wrap: break-word;
		color: rgba(51, 51, 51, 1);
		font-size: 32rpx;
		font-family: PingFangSC-Semibold;
		font-weight: 600;
		text-align: left;
		white-space: nowrap;
		line-height: 44rpx;
	}

	.text_3 {
		width: 208rpx;
		height: 36rpx;
		overflow-wrap: break-word;
		color: rgba(102, 102, 102, 1);
		font-size: 26rpx;
		font-weight: normal;
		text-align: left;
		white-space: nowrap;
		line-height: 36rpx;
		margin-top: 30rpx;
	}

	.button_1 {
		background-color: rgba(60, 114, 255, 1);
		border-radius: 30px;
		height: 50rpx;
		line-height: 50rpx;
		width: 140rpx;
		text-align: center;
		margin: 38rpx 28rpx 0 0;
	}

	.text_4 {
		overflow-wrap: break-word;
		color: rgba(255, 255, 255, 1);
		font-size: 24rpx;
		font-weight: normal;
		white-space: nowrap;
	}

	.image_1 {
		position: absolute;
		left: 0;
		top: 0;
		width: 750rpx;
		height: 88rpx;
	}

	.block_2 {
		background-color: rgba(255, 255, 255, 1);
		border-radius: 2px;
		width: 750rpx;
		margin: 122rpx 0 0 0rpx;
	}

	/* .block_2:active{
		background-color: #eee;
	} */

	.box_1 {
		width: 750rpx;
		height: 104rpx;
		padding-left: 28rpx;
		line-height: 104rpx;
		display: flex;
		align-items: center;

	}

	.box_1:active {
		background-color: #eee;
	}

	.image-text_2 {
		width: 322rpx;
		height: 48rpx;
	}

	.icon_1 {
		height: 48rpx;
		background: white 100% no-repeat;
		background-size: 100% 100%;
		width: 48rpx;
	}

	.label_1 {
		width: 48rpx;
		height: 48rpx;
	}

	.text-group_2 {
		width: 258rpx;
		height: 40rpx;
		overflow-wrap: break-word;
		color: rgba(0, 0, 0, 1);
		font-size: 28rpx;
		font-family: Helvetica;
		font-weight: normal;
		text-align: left;
		white-space: nowrap;
		line-height: 40rpx;
		margin-top: 4rpx;

	}



	.icon_2 {
		width: 28rpx;
		height: 28rpx;
		margin-right: 28rpx;
	}

	.box_2 {
		width: 630rpx;
		height: 48rpx;
		margin-left: 28rpx;
	}

	.image-text_3 {
		width: 176rpx;
		height: 48rpx;
	}

	.icon_3 {
		width: 48rpx;
		height: 48rpx;
	}

	.text-group_3 {
		width: 112rpx;
		height: 40rpx;
		overflow-wrap: break-word;
		color: rgba(0, 0, 0, 1);
		font-size: 28rpx;
		font-weight: normal;
		text-align: left;
		white-space: nowrap;
		line-height: 40rpx;
		margin-top: 4rpx;
	}



	.tab-bar_1 {
		background-color: rgba(255, 255, 255, 1);
		width: 750rpx;
		height: 100rpx;
		margin-top: 802rpx;
	}

	.tab-bar-item_1 {
		width: 48rpx;
		height: 82rpx;
		margin: 10rpx 0 0 102rpx;
	}

	.icon_5 {
		width: 48rpx;
		height: 48rpx;
	}

	.text_5 {
		width: 44rpx;
		height: 30rpx;
		overflow-wrap: break-word;
		color: rgba(187, 187, 187, 1);
		font-size: 22rpx;
		font-weight: normal;
		text-align: left;
		white-space: nowrap;
		line-height: 30rpx;
		margin: 4rpx 0 0 2rpx;
	}

	.tab-bar-item_2 {
		width: 66rpx;
		height: 82rpx;
		margin: 10rpx 0 0 194rpx;
	}

	.icon_6 {
		width: 48rpx;
		height: 48rpx;
		margin-left: 8rpx;
	}

	.text_6 {
		width: 66rpx;
		height: 30rpx;
		overflow-wrap: break-word;
		color: rgba(187, 187, 187, 1);
		font-size: 22rpx;
		font-weight: normal;
		text-align: left;
		white-space: nowrap;
		line-height: 30rpx;
		margin-top: 4rpx;
	}

	.tab-bar-item_3 {
		width: 48rpx;
		height: 82rpx;
		margin: 10rpx 100rpx 0 192rpx;
	}

	.icon_7 {
		width: 48rpx;
		height: 48rpx;
	}

	.text_7 {
		width: 44rpx;
		height: 30rpx;
		overflow-wrap: break-word;
		color: rgba(60, 114, 255, 1);
		font-size: 22rpx;
		font-weight: normal;
		text-align: left;
		white-space: nowrap;
		line-height: 30rpx;
		margin: 4rpx 0 0 2rpx;
	}

	.image_2 {
		width: 750rpx;
		height: 64rpx;
		margin-bottom: 2rpx;
	}


	body *,
	page view {
		box-sizing: border-box;
		flex-shrink: 0;
	}

	body {
		font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma,
			Arial, PingFang SC-Light, Microsoft YaHei;
		margin: 0;
	}

	button {
		margin: 0;
		padding: 0;
		border: 1px solid transparent;
		outline: none;
		background-color: transparent;
	}

	button:active {
		opacity: 0.6;
	}

	.flex-col {
		display: flex;
		flex-direction: column;
	}

	.flex-row {
		display: flex;
		flex-direction: row;
	}

	.justify-start {
		display: flex;
		justify-content: flex-start;
	}

	.justify-center {
		display: flex;
		justify-content: center;
	}

	.justify-end {
		display: flex;
		justify-content: flex-end;
	}

	.justify-evenly {
		display: flex;
		justify-content: space-evenly;
	}

	.justify-around {
		display: flex;
		justify-content: space-around;
	}

	.justify-between {
		display: flex;
		justify-content: space-between;
	}

	.align-start {
		display: flex;
		align-items: flex-start;
	}

	.align-center {
		display: flex;
		align-items: center;
	}

	.align-end {
		display: flex;
		align-items: flex-end;
	}
</style>